#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
using namespace std;

string func(string inString){
    string OutString;
    stringstream ss(inString);
    string s;
    while(getline(ss,s,' ')){
        reverse(s.begin(),s.end());
        OutString+=s;
        OutString+=" ";
    }
    return OutString.substr(0,OutString.size()-1);
}

int main(){
    cout<<func("123 123 abc");
    return 0;
}